Page({
  data: {
    repairList: [],
    isEmpty: false
  },
  goDetail(ev) {
    wx.navigateTo({
      url: '/repair_pkg/pages/detail/index?id=' + ev.mark.id,
    })
  },
  addRepair() {
    wx.navigateTo({
      url: '/repair_pkg/pages/form/index',
    })
  },
  onShow() {
    this.getRepairList()
  },
  async getRepairList() {
    const {
      code,
      data
    } = await wx.http.get('/repair', {
      current: 1,
      pageSize: 10
    })
    if (code !== 10000) return wx.utils.toast('获取报修列表失败')
    this.setData({
      repairList: data.rows,
      isEmpty: data.rows.length === 0
    })

  },
  // 如何做上拉加载，只需要监听上拉触底的事件，就是 onReachBottom，后面讲
  onReachBottom() {
    console.log(1)
  }
})